Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera fields may be undefined if it is still morphing #3868

Merged
merged 6 commits into from
Apr 21, 2016

Conversation

lasalvavida
Copy link
Contributor

Fix for #3865

@hpinkos
Copy link
Contributor

hpinkos commented Apr 20, 2016

Thanks @lasalvavida! Can you add a unit test?

@lasalvavida
Copy link
Contributor Author

@hpinkos Updated with test

@hpinkos
Copy link
Contributor

hpinkos commented Apr 20, 2016

The test you wrote passes in master. That means it's not really testing the change you made. It should fail in master and pass on this branch. I think that's happening because options.camera isn't a real Camera. It's mocked at the top of the file. Change heading and pitch to undefined for this test, then change them back to 0.0 so subsequent tests still pass.

@lasalvavida
Copy link
Contributor Author

Good catch @hpinkos; I updated the test

@hpinkos
Copy link
Contributor

hpinkos commented Apr 20, 2016

Great, thanks @lasalvavida! Update CHANGES.md and this will be good to go

@lasalvavida
Copy link
Contributor Author

Updated

var oldPitch = options.camera.pitch;

options.camera._mode = SceneMode.MORPHING;
options.camera.heading = undefined;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought, since this test can run asynchronously, I think we need to make a copy of options for this test instead. Otherwise there may be a race condition that causes other tests to intermittently fail.

@lasalvavida
Copy link
Contributor Author

@hpinkos This update should avoid that race condition. It also removes the need to explicitly set the properties to undefined since it is a real camera now whose fields will be undefined while in morphing mode.

@hpinkos
Copy link
Contributor

hpinkos commented Apr 21, 2016

Everything looks good! Thanks @lasalvavida!

@hpinkos hpinkos merged commit f95567d into CesiumGS:master Apr 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants